import java.util.Scanner;

/**
 * @author: gao
 * @create-date: 2025/3/27 20:53
 */

public class Solution {
    public int missingNumber(int[] nums) {
        int ret = 0;
        for (int i : nums) ret ^= i;
        for (int i = 0; i <= nums.length; i++) {
            ret ^= i;
        }
        return ret;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt();
            int[] nums = new int[n];
            for (int i = 0; i < n; i++) {
                nums[i] = in.nextInt();
            }
            Solution solution = new Solution();
            System.out.println(solution.missingNumber(nums));
        }
    }
}